package com.startasone.controller;

import com.startasone.Utlis.AliOSSUtils;
import com.startasone.pojo.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@Slf4j
public class UploadController {

    @Autowired
    AliOSSUtils aliOSSUtils;
    @PostMapping("/upload")
    public Result upload(MultipartFile image) throws Exception {
        log.info("要输入的图片为"+image.getOriginalFilename());
        String url=aliOSSUtils.upload(image);
        return Result.success(url);
    }
}
